﻿<%@ Page Language="C#" AutoEventWireup="true" Codebehind="Plate.aspx.cs" ValidateRequest="false"
    Inherits="LabMS.Web.Post.BBS.Plate" %>

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>在线交流 - 版块主题</title>
    <base target="_self" />
    <link type="text/css" rel="stylesheet" href="../../style/screen.css" />
    <link href="../../style/post.css" rel="stylesheet" type="text/css" />
    <!--[if lte IE 6]>
    <link type="text/css" rel="stylesheet" href="../../style/ie6.css" />
    <![endif]-->
    <!--[if lte IE 7]>
    <link type="text/css" rel="stylesheet" href="../../style/ie7.css" />
    <![endif]-->
</head>
<body class="mainBody">
    <form id="form1" runat="server">
        <div class="main">
            <div id="pageInfo" class="clearfix">
                <div class="title">
                    <label>
                        <a href="Index.aspx">在线交流</a></label>
                    &gt;
                    <label>
                        <a href="javascript:;">所属分区</a></label>
                    &gt;
                    <label>
                        版块</label>
                </div>
            </div>
        </div>
        <div class="main">
            <p>
                <input type="button" value="发起主题" id="btnPubPost" class="button" />
            </p>
            <div class="subjectContainer">
                <div class="subjectHeader clearfix">
                    <div class="subjectTitle">
                        <strong>主题</strong>
                    </div>
                    <div class="subjectPoster">
                        <strong>发贴者</strong>
                    </div>
                    <div class="subjectCount">
                        <strong>回复/浏览次数</strong>
                    </div>
                    <div class="subjectLastReplier">
                        <strong>最后回复</strong>
                    </div>
                </div>
                <%
                    ExtendBLL.Post post = new ExtendBLL.Post();
                    LabMS.Model.PostReply pr = new LabMS.Model.PostReply();
                    for (int i = 0; i < dsPosts.Tables[0].Rows.Count; i++)
                    {
                        System.Data.DataRow row = dsPosts.Tables[0].Rows[i];
                %>
                <div class="subject clearfix">
                    <input type="hidden" value='<%= row["ID"].ToString() %>'' />
                    <div class="subjectTitle">
                        <%= row["PostTitle"].ToString()%>
                    </div>
                    <div class="subjectPoster">
                        <p>
                            <%= post.GetAuthorNamePrefix(row["PosterType"].ToString())%>
                            <% string authorName = post.GetAuthorName(int.Parse(row["PosterID"].ToString()), row["PosterType"].ToString());
                               Response.Write(string.IsNullOrEmpty(authorName) ? "<del>已删除用户</del>" : authorName);
                            %>
                        </p>
                        <p>
                            发表于
                            <%= (DateTime.Parse(row["PostRecordTime"].ToString())).ToString("yy-MM-dd HH:mm") %>
                        </p>
                    </div>
                    <div class="subjectCount">
                        <%= row["PostReplyCount"].ToString()%>
                        /
                        <%= row["ViewTimes"]%>
                    </div>
                    <div class="subjectLastReplier">
                        <% if (string.Equals(row["PostReplyCount"].ToString(), "0"))
                           {
                               Response.Write("暂无回复");
                           }
                           else
                           {
                               pr = post.GetLatestReply(int.Parse(row["ID"].ToString()));

                               if (pr != null)
                               {

                                   string name = post.GetAuthorName(pr.ReplierID.Value, pr.ReplierType.ToString());
                        %>
                        <p>
                            <%= post.GetAuthorNamePrefix(pr.ReplierType.ToString())%>
                            <%= string.IsNullOrEmpty(name) ? "<del>已删除用户</del>" : name %>
                        </p>
                        <p>
                            <%= pr.PostReplyTime.Value.ToString("yy-MM-dd HH:mm")%>
                        </p>
                        <%
                            }
                        }
                        %>
                    </div>
                </div>
                <%} %>
                <p>
                    <webdiyer:AspNetPager ID="AspNetPager" PageSize="10" runat="server" UrlPaging="False"
                        FirstPageText="首页" LastPageText="尾页" NextPageText="下一页" OnPageChanged="AspNetPager_PageChanged"
                        PrevPageText="上一页" Direction="LeftToRight" HorizontalAlign="Right" Wrap="False">
                    </webdiyer:AspNetPager>
                </p>
            </div>
        </div>
    </form>

    <script type="text/javascript" src="../../js/jQuery/jquery-1.3.1.js"></script>

    <script type="text/javascript" src="../../js/jQuery/jquery.queryString.js"></script>

    <script type="text/javascript">
        $(function(){
            $("#btnPubPost").click(function(){
                var dt = new Date();
                var id = $.queryString({id:"plateID"}); // 获取queryString中的plateID值

                /* var rv = window.showModalDialog("PubishPost.aspx?plateID=" + id + "&time=" + dt, window, 'dialogWidth=700px;dialogHeight=550px;help:no;status:no');
                if (rv != null && rv) {
                    window.location.replace(window.location);
                }*/
                var newWin = window.open("PubishPost.aspx?plateID=" + id, "win", "height=550, width=750, top=0, left=0, toolbar=no, menubar=no, scrollbars=yes, resizable=yes,location=no, status=no");newWin.focus();
            });

            $("div.subject").dblclick(function(){
                var postID = $(this).find("input[type='hidden']").val();
                window.location.href = "Detail.aspx?postID=" + postID;
            });
        });
    </script>

</body>
</html>
